package com.idanchuang.component.just.web.config;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yjy
 * @date 2019/12/11 11:37
 **/
public class XssFilterConfig {

    /** 是否启用过滤器 */
    private boolean enabled = false;
    /** 过滤策略, 默认拒绝访问 */
    private XssPolicy policy = XssPolicy.REJECT;
    /** 检测名单, 默认全部 */
    private List<String> includeUrls = new ArrayList<>();
    /** 白名单 */
    private List<String> excludeUrls = new ArrayList<>();
    /** 错误信息 */
    private String errorMsg = "非法参数";

    public boolean isEnabled() {
        return enabled;
    }

    public List<String> getExcludeUrls() {
        return excludeUrls;
    }

    public void setExcludeUrls(List<String> excludeUrls) {
        this.excludeUrls = excludeUrls;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public XssPolicy getPolicy() {
        return policy;
    }

    public List<String> getIncludeUrls() {
        return includeUrls;
    }

    public void setIncludeUrls(List<String> includeUrls) {
        this.includeUrls = includeUrls;
    }

    public void setPolicy(XssPolicy policy) {
        this.policy = policy;
    }

    @Override
    public String toString() {
        return "XssFilterConfig{" +
                "enabled=" + enabled +
                ", policy=" + policy +
                ", includeUrls=" + includeUrls +
                ", excludeUrls=" + excludeUrls +
                ", errorMsg='" + errorMsg + '\'' +
                '}';
    }
}

